-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #11480, disallow delete operator on readonly property or index signature #11990
fix #11480, disallow delete operator on readonly property or index signature #11990
Conversation
Looks good to me. Pretty stupid that we allowed |
Sorry, I didn't catch your point. Do you mean "check readonly property only when delete property access or indexer" is good or "disallow delete anything other than property access or indexer"? For the latter, I think it would break namespace. namespace A {
export var a = 123;
delete a;
} And it would break unintentional code like // in other file like html
window.globalProperty = 123
// in ts
declare var globalProperty
delete globalPropery |
I believe both of those should be errors for the sake of clarity (unless there are some compelling use cases from real code to bring up). In the namespace case, it would be very confusing because the behavior would have to change (to become an error) depending on whether you wrote In the global case, we often require globals to be prefixed by |
@ahejlsberg I found |
59ff35a
to
023d5ca
Compare
@HerringtonDarkholme can you refresh the PR. |
@dotnet-bot test ci please Hmmm, it seems node.6 CI breaks due to mismatched shasum check. |
@dotnet-bot test ci please |
Fixes #11480
It changed more tests than I thought. Should we check delete operator only if it is a property access or indexer?